package com.levy.contronller.jvm.classLoader;

/**
 * Created by levy on 2019/6/4.
 */
public class MyTest19 {

    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        MyClassLoader loader1 = new MyClassLoader("loader1");
        loader1.setPath("C:\\Users\\levy\\Desktop\\");


        Class<?> clazz = loader1.loadClass("com.levy.contronller.jvm.classLoader.MyTest1");
        System.out.println("clazz: "+clazz.hashCode());

        Object o = clazz.newInstance();
        System.out.println(o);

        System.out.println();

        MyClassLoader loader2 = new MyClassLoader("loader2");
        loader2.setPath("C:\\Users\\levy\\Desktop\\");


        Class<?> clazz2 = loader2.loadClass("com.levy.contronller.jvm.classLoader.MyTest1");
        System.out.println("clazz: "+clazz2.hashCode());

        Object o2 = clazz.newInstance();
        System.out.println(o2);


        System.out.println();

    }
}
